atomic_lib 0.23.3

Library for creating, storing, querying, validating and converting Atomic Data.
Documentation

atomic-lib

crates.io Released API docs Discord chat MIT licensed github

Status: Alpha. Prone to breaking changes. Changelog

Rust library for using Atomic Data.

Docs

The atomic CLI and atomic-server applications both use this atomic-lib library.

  • In-memory store for getting / setting data (Store)
  • On disk ACID compliant store / database (Db, uses Sled)
  • Path traversal
  • Parse and serialize AD3
  • JSON + JSON-LD Serialization
  • Convert to Rust native types
  • Resolve / parse mappings (bookmarks)
  • Validate Atomic Graphs
  • Mutations (linked-delta's)
  • RDF (turtle / N-Triples) Serialization
  • Strategy for extending datatypes (Currently uses an enum)
  • TPF queries
  • Performant TPF queries from Db (create index)
  • Async resource fetching (faster)
  • Store - server write interaction (update resource, send deltas to server)

Usage

# Add it to your project
cargo add atomic_lib
use atomic_lib;

fn main() {
  // Let's parse this AD3 string
  let string = String::from(r#"["_:test","https://atomicdata.dev/properties/shortname","Test"]"#);
  // Start with initializing our store
  let mut store = atomic_lib::store::Store::init();
  // Run parse...
  store.parse_ad3(&string).unwrap();
  // Get our resource...
  let my_resource = store.get(&"_:test".into()).unwrap();
  // Get our value by filtering on our property...
  let my_value = my_resource.get("https://atomicdata.dev/properties/shortname").unwrap();
  println!("My value: {}", my_value);
  assert!(my_value == "Test")
}

Optional features

Some features of this library are optional, to minimize bundle size and compile times.

db

The db features adds persistence, which means that you can store stuff on an HDD / SSD. It uses [Sled], a performant, embedded key-value store.

rdf

If you need RDF serialization options (Turtle / N-Triples), use this feature.